<?php

if( ! defined('DOCROOT') )
{
    require_once '/var/www/advancelab/chilik2/unittest/bootstrap.php';
}

class MVCRequestTest extends UnitTestCase
{
    function testingMvcRequest()
    {
        $struct = new Core\MVCRequest();
        
        $this->assertIdentical($struct,new Core\MVCRequest);
        $this->assertTrue($struct instanceof Core\MVCRequest);
        
        
        $struct->date = 'php';
        $this->assertEqual( 'php', $struct->date);
        $struct->protocol = 'ezc';
        $this->assertEqual( 'ezc', $struct->protocol);
        $struct->host = 'ezp';
        $this->assertEqual( 'ezp', $struct->host);
        $struct->uri = 'buddymiles';
        $this->assertEqual( 'buddymiles', $struct->uri);
        $struct->requestId = 'buddyguy';
        $this->assertEqual( 'buddyguy', $struct->requestId);
        $struct->referrer = 'django';
        $this->assertEqual( 'django', $struct->referrer);
        $struct->variables = 'satchmo';
        $this->assertEqual( 'satchmo', $struct->variables);
        $struct->body = 'vim';
        $this->assertEqual( 'vim', $struct->body);
        $struct->files = 'linux';
        $this->assertEqual( 'linux', $struct->files);
        $struct->accept = 'gentoo';
        $this->assertEqual( 'gentoo', $struct->accept );
        $struct->agent = 'debian';
        $this->assertEqual( 'debian', $struct->agent);
        $struct->authentication = 'oop';
        $this->assertEqual( 'oop', $struct->authentication);
        $struct->raw = 'random';
        $this->assertEqual( 'random', $struct->raw);
        
        /* $this->dump($struct); */
    }
    
    public function testMockingMethod()
    {
        $state = array(
        'date' => 'php',
        'protocol' => 'ezc',
        'host' => 'ezp',
        'uri' => 'buddymiles',
        'requestId' => 'buddyguy',
        'referrer' => 'django',
        'variables' => 'satchmo',
        'body' => 'vim',
        'files' => 'linux',
        'accept' => 'gentoo',
        'agent' => 'debian',
        'authentication' => 'oop',
        'raw' => 'random',
        'cookies' => 'foo',
        'isFatal' => false,
        );
        
        $struct = Core\MvcRequest::__mock( $state );
        
        $this->assertEqual( 'php', $struct->date);
        $this->assertEqual( 'ezc', $struct->protocol);
        $this->assertEqual( 'ezp', $struct->host);
        $this->assertEqual( 'buddymiles', $struct->uri);
        $this->assertEqual( 'buddyguy', $struct->requestId);
        $this->assertEqual( 'django', $struct->referrer);
        $this->assertEqual( 'satchmo', $struct->variables);
        $this->assertEqual( 'vim', $struct->body);
        $this->assertEqual( 'linux', $struct->files);
        $this->assertEqual( 'gentoo', $struct->accept);
        $this->assertEqual( 'debian', $struct->agent);
        $this->assertEqual( 'oop', $struct->authentication);
        $this->assertEqual( 'random', $struct->raw);
        $this->assertEqual( 'foo', $struct->cookies);
    }
}

